package practice_03;

import java.util.Scanner;

//输入;整数字符串A,B
//要求:将A,B转换成int后相乘
//输出:乘积
public class Multiply {
    public static void multiply() {
        Scanner sc = new Scanner(System.in);
        System.out.print("请输入A:");
        String A = sc.nextLine();
        System.out.print("请输入B:");
        String B = sc.nextLine();
        int result = changeToInt(A) * changeToInt(B);
        System.out.println("result：" + result);
    }

    public static int changeToInt(String s) {
        int result = 0;
        for (int i = 0; i < s.length(); i++) {
            result = result * 10 + (s.charAt(i) - 48);
        }
        return result;
    }
}
